package xps.and.uudaijia.userclient.data.net;

import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
import xps.and.uudaijia.userclient.data.baen.AliPrePayOrder;
import xps.and.uudaijia.userclient.data.baen.CapitalListRes;
import xps.and.uudaijia.userclient.data.baen.CodeBean;
import xps.and.uudaijia.userclient.data.baen.CostBean;
import xps.and.uudaijia.userclient.data.baen.DoubleBean;
import xps.and.uudaijia.userclient.data.baen.DudgetBean;
import xps.and.uudaijia.userclient.data.baen.FKBean;
import xps.and.uudaijia.userclient.data.baen.GXBean;
import xps.and.uudaijia.userclient.data.baen.InformationBean;
import xps.and.uudaijia.userclient.data.baen.LoginBean;
import xps.and.uudaijia.userclient.data.baen.MapBean;
import xps.and.uudaijia.userclient.data.baen.OrderDetail;
import xps.and.uudaijia.userclient.data.baen.OrderListRes;
import xps.and.uudaijia.userclient.data.baen.PinCheYGBean;
import xps.and.uudaijia.userclient.data.baen.PrePayOrder;
import xps.and.uudaijia.userclient.data.baen.ReservationBean;
import xps.and.uudaijia.userclient.data.baen.SelectBean;
import xps.and.uudaijia.userclient.data.baen.SmsResponce;
import xps.and.uudaijia.userclient.data.baen.UrlBean;
import xps.and.uudaijia.userclient.data.baen.VehicleBean;
import xps.and.uudaijia.userclient.data.baen.WEBBean;
import xps.and.uudaijia.userclient.data.baen.WXQXBean;
import xps.and.uudaijia.userclient.data.baen.YHJBean;
import xps.and.uudaijia.userclient.data.serviceapi.UserApi;

public class UserNetWorks extends RetrofitUtils {

    protected static final UserApi UserApi = RetrofitUtils.getUserApi();
    protected static final UserApi UserGXApi = RetrofitUtils.getPayApiHuo();

    /*
    *注册验证码
     */
    public static void getVerification(String phoneNum, Subscriber<CodeBean> observer) {
        UserApi.doRegisterVerification(phoneNum).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    //注册验证
    public static void getSubmit(String code, String phoneNum, String password, String sex, Subscriber<CodeBean> observer) {
        UserApi.doRegisterSubmit(code, phoneNum, password, sex).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    //登录验证
    public static void getLogin(String loginMethod, String phoneNum, String password, Subscriber<LoginBean> observer) {
        UserApi.doRegisterLogin(loginMethod, phoneNum, password).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    //微信登录
    public static void getWechatLogin(String loginMethod, String openid, String nickname, String sex, String headImg, String country, String province, String city, Subscriber<LoginBean> observer) {
        UserApi.getwechatLogin(loginMethod, openid, nickname, sex, headImg, country, province, city).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    //获取其他司机经纬度
    public static void getMapJingWeiDu(String lat, String lng, String driverType, Subscriber<MapBean> observer) {
        UserApi.getwechatMapJingWeiDu(lat, lng, driverType).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    //获取预估价格
    public static void getReservation(String startTime, String startLng, String startLat, String endLng, String endLat, Subscriber<ReservationBean> observer) {
        UserApi.getReservationApi(startTime, startLng, startLat, endLng, endLat).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * 创建订单
     */
    public static void getReservationVehicle(String startTime, String startLng, String startLat, String startAddress, String endLng, String endLat, String endAddress, String phoneNum, String couponId, String FIRate, Subscriber<VehicleBean> observer) {
        UserApi.getReservationApiVehicle(startTime, startLng, startLat, startAddress, endLng, endLat, endAddress, phoneNum, couponId, FIRate).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /*
    * 查询订单列表
    * */
    public static void getOrderList(String orderType, String pagesize, String pageindex, Subscriber<OrderListRes> observer) {
        UserApi.getOrderList(orderType, pagesize, pageindex).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /*
      * 取消订单
      * */
    public static void getMapQuXiao(String orderId, String closedRemark, String whoCancel, Subscriber<CodeBean> observer) {
        UserApi.getQuXiao(orderId, closedRemark, whoCancel).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /*
    * 取消订单
    * */
    public static void getOrderDetail(String orderId, Subscriber<OrderDetail> observer) {
        UserApi.getOrderDetail(orderId).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }


    //查询有无订单
    public static void getHomeSelect(String str, Subscriber<SelectBean> observer) {
        UserApi.getReservationHomeSelect(str).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    //查询费用详情
    public static void getPaymentCost(String OrderId, Subscriber<CostBean> observer) {
        UserApi.getPaymentCost(OrderId).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    //评论订单
    public static void getPL(String OrderId, String score, String content, Subscriber<CodeBean> observer) {
        UserApi.getPL(OrderId, score, content).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    //评论订单
    public static void getDeldet(String OrderId, Subscriber<CodeBean> observer) {
        UserApi.getDeldet(OrderId).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }


    //催一催
    public static void getReminder(String OrderId, String radius, Subscriber<CodeBean> observer) {
        UserApi.getReminder(OrderId, radius).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    //用户修改密码
    public static void UpdatePassword(String oldPwd, String newPwd, Subscriber<SmsResponce> observer) {
        UserApi.getUpdatePassword(oldPwd, newPwd).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    //用户修改个人资料
    public static void getModifyMe(String name, String sex, Subscriber<SmsResponce> observer) {
        UserApi.getUpdateModifyMe(name, sex).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    //微信余额充值
    public static void getweCount(String clientType, String money, Subscriber<PrePayOrder> observer) {
        UserApi.getweCount(clientType, money).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /*
* 查询消费记录
* */
    public static void getCapitalList(String pageSize, String pageIndex, Subscriber<CapitalListRes> observer) {
        UserApi.getCapitalList(pageSize, pageIndex).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    //微信余额充值
    public static void getweQX(String orderSn, Subscriber<WXQXBean> observer) {
        UserApi.getweQX(orderSn).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }


    //查询个人信息
    public static void getInformation(String startTime, Subscriber<InformationBean> observer) {
        UserApi.getInformation(startTime).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    //查询雇佣司机
    public static void getDudget(String hiringTime, String startLng, String startLat, String endLng, String endLat, Subscriber<DudgetBean> observer) {
        UserApi.getDudget(hiringTime, startLng, startLat, endLng, endLat).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }


    /**
     * 创建订单
     */
    public static void getHiring(String hiringTime, String startTime, String startLng, String startLat, String startAddress, String endLng, String endLat, String endAddress, String couponId, String FIRate, Subscriber<VehicleBean> observer) {
        UserApi.getHiring(hiringTime, startTime, startLng, startLat, startAddress, endLng, endLat, endAddress, couponId, FIRate).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * 获取修改密码验证码
     */
    public static void getUPMMYZM(String phoneNum, Subscriber<SmsResponce> observer) {
        UserApi.getUPMMYZM(phoneNum).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }
    /**
     * 获取修改密码验证码
     */
    public static void getMMYZM(String phoneNum, Subscriber<SmsResponce> observer) {
        UserApi.getMMYZM(phoneNum).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * 获取修改密码验证码
     */
    public static void getUPMM(String phoneNum, String code,Subscriber<SmsResponce> observer) {
        UserApi.getUPMM(phoneNum,code).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * 获取修改密码验证码
     */
    public static void getUPUPMM(String code, String phoneNum, String password, Subscriber<SmsResponce> observer) {
        UserApi.getUPUPMM(code, phoneNum, password).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * 获取
     */
    public static void getWEBView(String type, Subscriber<WEBBean> observer) {
        UserApi.getWEBView(type).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * 优惠劵
     */
    public static void getYHJ(String teorzc, Subscriber<YHJBean> observer) {
        UserApi.getYHJ(teorzc).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * 支付宝余额充值
     */
    public static void getZFBCount(String clientType, String money, Subscriber<AliPrePayOrder> observer) {
        UserApi.getZFBCount(clientType, money).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * 支付宝余额充值
     */
    public static void getfankui(String content, Subscriber<FKBean> observer) {
        UserApi.getfankui(content).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }


    /**
     * 是否加倍
     */
    public static void getDouble(String content, Subscriber<DoubleBean> observer) {
        UserApi.getDouble(content).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * 支付宝余额充值
     */
    public static void getGengXin(String vid, Subscriber<GXBean> observer) {
        UserGXApi.getGengXin(vid).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    //获取其他司机经纬度
    public static void getHuoDong(String driverType, Subscriber<UrlBean> observer) {
        UserGXApi.getHuoDong(driverType).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * 快车查询价格
     */
    public static void getPingCHeYG(String startLng, String startLat, String endLng, String endLat, String ping, String peopleNum, Subscriber<PinCheYGBean> observer) {
        UserApi.getPingCHeYG(startLng, startLat, endLng, endLat, ping, peopleNum).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * 快车查询价格
     */
    public static void getBuPingCHeYG(String startLng, String startLat, String endLng, String endLat, String ping, String peopleNum, Subscriber<PinCheYGBean> observer) {
        UserApi.getBuPingCHeYG(startLng, startLat, endLng, endLat, ping, peopleNum).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * 创建快车订单
     */
    public static void getKuaiChe(String startTime, String startLng, String startLat, String startAddress, String endLng, String endLat, String endAddress, String ping, String peopleNum, String couponId, String FIRate, Subscriber<VehicleBean> observer) {
        UserApi.getKuaiChe(startTime, startLng, startLat, startAddress, endLng, endLat, endAddress, ping, peopleNum, couponId, FIRate).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * 创建快车订单
     */
    public static void getKuaiCheYse(String startTime, String startLng, String startLat, String startAddress, String endLng, String endLat, String endAddress, String ping, String peopleNum, String couponId, String FIRate, Subscriber<VehicleBean> observer) {
        UserApi.getKuaiCheYse(startTime, startLng, startLat, startAddress, endLng, endLat, endAddress, ping, peopleNum, couponId, FIRate).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }
}
